#!/bin/sh

FILENAME=$1
count=0
while read LINE
do
  let count++
  #echo "line# $count: $LINE"
  if [[ $LINE == "1 2 3 4 5" ]]
  then 
    echo write number line to numberOutput.txt
    echo $LINE >> numberOutput.txt
  fi
  if [[ $LINE == *cat* ]]
  then
    echo write cat to catOutput.txt
    echo $LINE >> catOutput.txt
    RESULT="$( cut -d "=" -f 2 <<< $LINE )"
    echo $RESULT >> resultOutput.txt
  fi
done < "$FILENAME"

echo -e "\nTotal $count Lines read."
